package config

import "context"

type ApplicationConfig struct {
	Context    context.Context
	Debug      bool
	CORS       bool
	ConfigsDir string
	UploadDir  string

	LLMApiKey    string
	LLMBaseUrl   string
	LLMModelName string

	DBFilePath string
}

type AppOption func(config *ApplicationConfig)

func NewApplicationConfig(o ...AppOption) *ApplicationConfig {
	opt := &ApplicationConfig{
		Context: context.Background(),
		Debug:   true,
	}
	for _, oo := range o {
		oo(opt)
	}
	return opt
}

func WithContext(ctx context.Context) AppOption {
	return func(o *ApplicationConfig) {
		o.Context = ctx
	}
}

func WithDebug(debug bool) AppOption {
	return func(o *ApplicationConfig) {
		o.Debug = debug
	}
}

func WithCors(b bool) AppOption {
	return func(o *ApplicationConfig) {
		o.CORS = b
	}
}

func WithUploadDir(uploadDir string) AppOption {
	return func(o *ApplicationConfig) {
		o.UploadDir = uploadDir
	}
}

func WithConfigsDir(configsDir string) AppOption {
	return func(o *ApplicationConfig) {
		o.ConfigsDir = configsDir
	}
}

func WithLLMApiKey(apiKey string) AppOption {
	return func(o *ApplicationConfig) {
		o.LLMApiKey = apiKey
	}
}

func WithLLMBaseUrl(baseUrl string) AppOption {
	return func(o *ApplicationConfig) {
		o.LLMBaseUrl = baseUrl
	}
}
func WithLLMModelName(modelName string) AppOption {
	return func(o *ApplicationConfig) {
		o.LLMModelName = modelName
	}
}

func WithDBFilePath(dbFilePath string) AppOption {
	return func(o *ApplicationConfig) {
		o.DBFilePath = dbFilePath
	}
}
